package wj.tree;

import wj.Scope;
import wj.WJValue;

public class AssignmentNode implements WJNode{

	private Scope scope;
	private String varName;
	private WJNode expressionNode;
	
	public AssignmentNode(Scope scope, String varName, WJNode expressionNode){
		this.scope = scope;
		this.varName = varName;
		this.expressionNode = expressionNode;
	}

	@Override
	public WJValue evaluate() {
		scope.assign(varName, expressionNode.evaluate());
		return WJValue.NULL;
	}
	
}
